class Solution {
public:
    int removeElement(vector<int>& nums, int val)
    {
        size_t r=nums.size();
        int left=0,right=0;
        while(right<r)
        {
             if(nums[right]!=val)
            {
                nums[left]=nums[right];
                left++;
            }
    
            right++;
        }
        return left;
    }
};
